package Java面试周阳.LockSupport;

import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.LockSupport;

public class Demo03 {
    public static void main(String[] args) {
        Thread a = new Thread(() -> {
            try {
                TimeUnit.SECONDS.sleep(3L);
            } catch (Exception e) {
                e.printStackTrace();
            }
            System.out.println(Thread.currentThread().getName() + "\t come in");
            LockSupport.park();
            System.out.println(Thread.currentThread().getName() + "\t 被唤醒");
        });
        a.start();


        Thread b = new Thread(() -> {
           LockSupport.unpark(a);
            System.out.println(Thread.currentThread().getName() + "\t 通知了");
        });
        b.start();
    }
}
